var prove_name = '';
var city = '';
var dist = '';
var app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    showProvinces:true,
    showCities:false,
    showDistricts:false,
    curNav: 1,
    
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    showProvinces: (options.showProvinces == "true" ? true : false)
    var that = this;
    wx.request({
      url:
      'https://www.cakeyouxuan.com/small/city/index',
      data: {
      },
      method: "POST",
      header: {
        "Content-Type": "application/x-www-form-urlencoded"  //post
      },
      success: function (res) {
        console.log(res);
        that.setData({
          provence: res.data.provence,
        });
      },
    })
  },

  // 选择省的时候样式
  getProce:function(res){
    let prove = res.currentTarget.dataset;
    let prove_id = res.currentTarget.dataset.ind;
    prove_name = res.currentTarget.dataset.name;
    // console.log(prove_name)
    var that = this;
 

    that.setData({
      showProvinces: (!that.data.showProvinces),
      showCities: (!that.data.showCities),
      ind_: prove_id
    })
  },
  // 选择市的时候
  getCities:function(res){
    city = res.currentTarget.dataset.name;
    let city_id = res.currentTarget.dataset.cit
    // console.log(city);
    var that = this;
    that.setData({
      showDistricts: (!that.data.showDistricts),
      showCities: (!that.data.showCities),
      cit_: city_id
    })
  },


  // 选择区的时候
  Districts: function (res) {
    dist = res.currentTarget.dataset.name;
    // console.log(dist);
    var that = this;

    that.setData({
      
    })
    // console.log(prove); console.log('20181-4');
    wx.navigateTo({
      // url: "/pages/yiguo/address2/address2" 
      url: "/pages/yiguo/address2/address2?prove=" + prove_name+"-" + "&city=" + city+"-" + "&dist=" + dist
    }) 

  },

  /** * 生命周期函数--监听页面初次渲染完成 */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  }
})


